
enum Type {
	CDI, CDD
};

public class Contrat {
	Type typeContratcdi = Type.CDI;
	Type typeContratcdd = Type.CDD;

	private Employee employee;
	private String nomEntreprise;
	private int debut;
	private int fin;
	private String type;
	private int salaire;
	
	public Contrat (String type){
		this.debut=1;
		this.salaire=100;
		nomEntreprise="TOYOTA";
		this.fin=-1;
		if(type.equals(typeContratcdd))
			this.fin=2;
	}

	
	public void setSalaire(int sal) {
		if(sal>0)
			this.salaire = sal;
		else
			this.salaire = 1400;
	}

	public int getSalaire() {
		return salaire;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee e) {
		if(e.getContrat()!=null){
			e.removeContrat();
		}
		e.setContrat(this);
		this.employee = e;
	}

	public int getDebut() {
		return debut;
	}

	public void setDebut(int debut) {
		if(debut>0 ){
			if (type.equals(typeContratcdi)) 
				this.debut = debut;
			else if (debut<this.fin)
				this.debut = debut;
		}
		
	}

	
	public int getFin() {
		return fin;
	}

	public void setFin(int fin) {
		if(fin>this.debut)
		this.fin = fin;
	}
	
	

	public String getNomEntreprise() {
		return nomEntreprise;
	}


	public void setNomEntreprise(String nomEntreprise) {
		this.nomEntreprise = nomEntreprise;
	}


	public String getType() {
		return type;
	}

	public void setType(String type) {
		if(type.equals(typeContratcdd) || type.equals(typeContratcdi))
		this.type = type;
	}

	public Type getTypeContratcdi() {
		return typeContratcdi;
	}

	public void setTypeContratcdi(Type typeContratcdi) {
		this.typeContratcdi = typeContratcdi;
	}

	public Type getTypeContratcdd() {
		return typeContratcdd;
	}

	public void setTypeContratcdd(Type typeContratcdd) {
		this.typeContratcdd = typeContratcdd;
	}
	
	
}
